package com.dingwen.stusprbooes.service.impl;

import com.dingwen.stusprbooes.dao.IndexDao;
import com.dingwen.stusprbooes.service.IndexService;
import org.elasticsearch.client.indices.CreateIndexResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;

/**
 * elasticsearch impl
 * @author dingwen
 * 2021/6/27 21:10
 **/
@Service
public class IndexServiceImpl implements IndexService {

    private final IndexDao indexDao;

    @Autowired
    public IndexServiceImpl(IndexDao indexDao) {
        this.indexDao = indexDao;
    }

    @Override
    public CreateIndexResponse createIndex(String index) throws IOException {
        return indexDao.create(index);
    }
}
